home *** CD-ROM | disk | FTP | other *** search
- package mx.core
- {
- import flash.events.Event;
- import flash.system.ApplicationDomain;
- import mx.containers.BoxDirection;
- import mx.containers.utilityClasses.BoxLayout;
- import mx.containers.utilityClasses.CanvasLayout;
- import mx.containers.utilityClasses.Layout;
- import mx.resources.ResourceBundle;
-
- use namespace mx_internal;
-
- public class LayoutContainer extends Container
- {
- private static var viewSourceMenuItem:String;
-
- mx_internal static const VERSION:String = "2.0.1.0";
-
- private static var packageResources:ResourceBundle = ResourceBundle.getResourceBundle("core",ApplicationDomain.currentDomain);
-
- mx_internal static var useProgressiveLayout:Boolean = false;
-
- loadResources();
-
- private var _layout:String = "vertical";
-
- private var processingCreationQueue:Boolean = false;
-
- private var creationQueue:Array;
-
- protected var boxLayoutClass:Class;
-
- private var preloadObj:Object;
-
- private var resizeHandlerAdded:Boolean = false;
-
- protected var layoutObject:Layout;
-
- protected var canvasLayoutClass:Class;
-
- public function LayoutContainer()
- {
- layoutObject = new BoxLayout();
- canvasLayoutClass = CanvasLayout;
- boxLayoutClass = BoxLayout;
- resizeHandlerAdded = false;
- creationQueue = [];
- processingCreationQueue = false;
- _layout = ContainerLayout.VERTICAL;
- super();
- layoutObject.target = this;
- }
-
- private static function loadResources() : void
- {
- viewSourceMenuItem = packageResources.getString("viewSource");
- }
-
- override mx_internal function get usePadding() : Boolean
- {
- return layout != ContainerLayout.ABSOLUTE;
- }
-
- override protected function measure() : void
- {
- super.measure();
- layoutObject.measure();
- }
-
- override protected function layoutChrome(param1:Number, param2:Number) : void
- {
- super.layoutChrome(param1,param2);
- if(!mx_internal::doingLayout)
- {
- createBorder();
- }
- }
-
- public function set layout(param1:String) : void
- {
- if(_layout != param1)
- {
- _layout = param1;
- if(layoutObject)
- {
- layoutObject.target = null;
- }
- if(_layout == ContainerLayout.ABSOLUTE)
- {
- layoutObject = new canvasLayoutClass();
- }
- else
- {
- layoutObject = new boxLayoutClass();
- if(_layout == ContainerLayout.VERTICAL)
- {
- BoxLayout(layoutObject).direction = BoxDirection.VERTICAL;
- }
- else
- {
- BoxLayout(layoutObject).direction = BoxDirection.HORIZONTAL;
- }
- }
- if(layoutObject)
- {
- layoutObject.target = this;
- }
- invalidateSize();
- invalidateDisplayList();
- dispatchEvent(new Event("layoutChanged"));
- }
- }
-
- [Bindable("layoutChanged")]
- public function get layout() : String
- {
- return _layout;
- }
-
- override protected function updateDisplayList(param1:Number, param2:Number) : void
- {
- super.updateDisplayList(param1,param2);
- layoutObject.updateDisplayList(param1,param2);
- createBorder();
- }
- }
- }
-
-